//
//  TKYSurveyView.m
//  StationHouseHelper
//
//  Created by apple on 2018/7/6.
//  Copyright © 2018年 铁科院. All rights reserved.
//

#import "TKYSurveyView.h"
@interface TKYSurveyView()
@property (nonatomic, strong)UIImageView *surveyImageV;


/**
 工程名称
 */
@property (nonatomic, strong)UILabel *projectNameLabel;

/**
 工程负责人
 */
@property (nonatomic, strong)UILabel *chargePersonlabel;

/**
 开工时间
 */
@property (nonatomic, strong)UILabel *starTimeLabel;
/**
 完工时间
 */
@property (nonatomic, strong)UILabel *endTimeLabel;

/**
 线
 */
@property (nonatomic, strong)UILabel *lineLabel;

@end
@implementation TKYSurveyView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.surveyImageV];
        [self addSubview:self.projectNameLabel];
        [self addSubview:self.chargePersonlabel];
        [self addSubview:self.starTimeLabel];
        [self addSubview:self.endTimeLabel];
        [self addSubview:self.lineLabel];
        
        [self.surveyImageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).with.offset(kHeightScale *15);
            make.top.equalTo(self).with.offset(kHeightScale *15);
            make.bottom.equalTo(self).with.offset(-kHeightScale *15);
           // make.height.mas_equalTo(kHeightScale *80);
            make.width.mas_equalTo(kWidthScale *150);
        }];
        
        [self.projectNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.surveyImageV.mas_right).with.offset(kWidthScale *10);
            make.top.equalTo(self.surveyImageV.mas_top).with.offset(0);
            make.right.equalTo(self).with.offset(-kWidthScale *10);
            make.height.mas_equalTo(kHeightScale *20);
//            make.width.mas_equalTo(100);
        }];
        
        [self.chargePersonlabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.surveyImageV.mas_right).with.offset(kWidthScale *10);
        make.top.equalTo(self.projectNameLabel.mas_bottom).with.offset(kHeightScale *8);
            make.right.equalTo(self).with.offset(-kWidthScale*10);
//            make.height.mas_equalTo(kHeightScale *20);
            //make.width.mas_equalTo(100);
        }];
        
       
        
        [self.starTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.surveyImageV.mas_right).with.offset(kWidthScale *10);
            make.top.equalTo(self.chargePersonlabel.mas_bottom).with.offset(kHeightScale *5);
            make.right.equalTo(self).with.offset(-kWidthScale *10);
            make.height.mas_equalTo(kHeightScale *20);
            //make.width.mas_equalTo(100);
        }];
        
        [self.endTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.surveyImageV.mas_right).with.offset(kWidthScale *10);
            make.top.equalTo(self.starTimeLabel.mas_bottom).with.offset(kHeightScale *5);
            make.right.equalTo(self).with.offset(-kWidthScale *10);
            make.height.mas_equalTo(kHeightScale *20);
            //make.width.mas_equalTo(100);
        }];
        
        [self.lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).with.offset(0);
            make.bottom.equalTo(self).with.offset(-kHeightScale *1);
            make.right.equalTo(self).with.offset(0);
            make.height.mas_equalTo(kHeightScale *1);
            //make.width.mas_equalTo(100);
        }];
    }
    return self;
}

- (UIImageView *)surveyImageV{
    if (_surveyImageV == nil) {
        _surveyImageV = [[UIImageView alloc]init];
        _surveyImageV.image = [UIImage imageNamed:@"login_bg"];
    }
    return _surveyImageV;
}

- (UILabel *)projectNameLabel{
    if (_projectNameLabel == nil) {
        _projectNameLabel = [[UILabel alloc]init];
        _projectNameLabel.text = @"清河站";
        _projectNameLabel.textColor = kUIColorFromRGB(333333, 1);
        _projectNameLabel.font = Font(14);
        
    }
    return _projectNameLabel;
}

- (UILabel *)chargePersonlabel{
    if (_chargePersonlabel == nil) {
        _chargePersonlabel = [[UILabel alloc]init];
        _chargePersonlabel.text = @"工程负责人:张某某";
        _chargePersonlabel.font = Font(12);
        _chargePersonlabel.textColor = kUIColorFromRGB(666666, 1);
       // _chargePersonlabel.numberOfLines = 0;
    }
    return _chargePersonlabel;
}

- (UILabel *)starTimeLabel{
    if (_starTimeLabel == nil) {
        _starTimeLabel = [[UILabel alloc]init];
        _starTimeLabel.text = @"开工日期:2018-6-10";
        _starTimeLabel.font = Font(12);
        _starTimeLabel.textColor = kUIColorFromRGB(666666, 1);

    }
    return _starTimeLabel;
}

- (UILabel *)endTimeLabel{
    if (_endTimeLabel == nil) {
        _endTimeLabel = [[UILabel alloc]init];
        _endTimeLabel.text = @"完工日期:2018-6-10";
        _endTimeLabel.font = Font(12);
        _endTimeLabel.textColor = kUIColorFromRGB(666666, 1);
    }
    return _endTimeLabel;
}

- (UILabel *)lineLabel{
    if (_lineLabel == nil) {
        _lineLabel = [[UILabel alloc]init];
        _lineLabel.backgroundColor = kRGBColor(237, 237, 237, 1);
    }
    return _lineLabel;
}

- (void)setProjectInfo:(TKYProjectInfoModel *)projectInfo{
    _projectInfo = projectInfo;
    _projectNameLabel.text = projectInfo.projectName;
    _chargePersonlabel.text = [NSString stringWithFormat:@"工程负责人:%@",projectInfo.deptName];
    _starTimeLabel.text = [NSString stringWithFormat:@"开工日期:%@",projectInfo.startDateStr];
    _endTimeLabel.text = [NSString stringWithFormat:@"完工日期:%@",projectInfo.endDateStr];
}



@end
